home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 2.iso / STUTTGART / TEX-UTIL / DVI_DVI1 / dvilj / c / dviIO < prev    next >
Text File  |  1996-02-20  |  19KB  |  660 lines

  1. #include "dvilj.h"
  2.  
  3.  
  4.  
  5. /* The following functions buffer input/output during CopyFile / CopyHPFile
  6.    Write functions are only needed if RISC_BUFFER is defined; otherwise output
  7.    is not buffered. */
  8.  
  9. /* read a buffered byte */
  10. char b_read(FILEPTR spfp)
  11. {
  12.   if (biact >= binumber)
  13.   {
  14.     #ifdef RISC_USE_OSL
  15.     binumber = BUFFSIZE - read_multi(buffin,1,BUFFSIZE,spfp);
  16.     #else
  17.     binumber = read_multi(buffin,1,BUFFSIZE,spfp);
  18.     #endif
  19.     biact = 0;
  20.   }
  21.   if (binumber == 0) {return(0);} else {return(buffin[biact++]);}
  22. }
  23.  
  24. #ifdef RISC_BUFFER
  25. /* write a buffered byte */
  26. void b_write(FILEPTR spfp, char c)
  27. {
  28.   if (boact >= BUFFSIZE)
  29.   {
  30.     write_multi(buffout,1,BUFFSIZE,spfp);
  31.     boact = 0;
  32.   }
  33.   buffout[boact++] = c;
  34. }
  35.  
  36. /* write a sequence of bytes to the output buffer */
  37. void b_wrtmult(FILEPTR spfp, char *buf, int len)
  38. {
  39.   register int i;
  40.  
  41.   if ((len > (BUFFSIZE - boact)) || (len >= (BUFFSIZE/4)))
  42.   {
  43.     write_multi(buffout,1,boact,spfp);
  44.     /* Copy only small blocks; large ones are written directly */
  45.     if (len < (BUFFSIZE/4)) {for (i=0; i<len; i++) {buffout[i] = buf[i];} boact = len;}
  46.                        else {write_multi(buf,1,len,spfp); boact = 0;}
  47.   }
  48.   else {for (i=0; i<len; i++) {buffout[boact++] = buf[i];}}
  49. }
  50.  
  51. /* flush the output buffer */
  52. void b_oflush(FILEPTR spfp)
  53. {
  54.   write_multi(buffout,1,boact,spfp);
  55.   boact = 0;
  56. }
  57. #endif
  58. /* end of buffer handling functions */
  59.  
  60.  
  61. /*-->CopyFile*/   /* copy a file straight through to output */
  62. /*********************************************************************/
  63. /***************************** CopyFile ******************************/
  64. /*********************************************************************/
  65. void
  66. CopyFile(char *str )
  67. {
  68.     FILEPTR spfp;
  69.     char    t;
  70.     int     todo;
  71.  
  72.     /*printf("CopyFile...\n");*/
  73.     if ((spfp = BINOPEN(str)) == FPNULL) {
  74.         Warning("Unable to open file %s", str );
  75.         return;
  76.     }
  77.     qfprintf(ERR_STREAM," [%s", str);
  78.     #ifdef RISC_BUFFER
  79.     b_oflush(outfp);
  80.     #endif
  81.     /* Let's speed things up a little
  82.     for (read_byte(spfp,(char)t); !FEOF(spfp); read_byte(spfp,(char)t))
  83.         write_byte(outfp,t);*/
  84.     do
  85.     {
  86.       todo = read_multi(buffin,1,BUFFSIZE,spfp);
  87.       write_multi(buffin,1,todo,outfp);
  88.     }
  89.     while (todo == BUFFSIZE);
  90.  
  91.     BCLOSE(spfp);
  92.     qfprintf(ERR_STREAM,"]");
  93. }
  94.  
  95.  
  96. /*-->CopyHPFile*/  /* copy a HP file to output removing unwanted control codes*/
  97. /*********************************************************************/
  98. /***************************** CopyHPFile ******************************/
  99. /*********************************************************************/
  100. void
  101. CopyHPFile(char  *str )
  102. {
  103.     FILEPTR spfp;
  104.     char    t,numstr[20];
  105.     int        count,rx,ry,miny,minx,num;
  106.  
  107.     /*printf("CopyHPFile...\n");*/
  108.     if ( (spfp = BINOPEN(str)) == FPNULL ) {
  109.         Warning("Unable to open file %s", str );
  110.         return;
  111.     }
  112.     minx=32767;            /* Set to a high value initially */
  113.     miny=32767;
  114.  
  115. /* Pass through the input PCL file twice.  The first time find the smallest  */
  116. /* x- and y-offsets so that they can be subtracted out when sending          */
  117. /* positioning commands later.   The second pass strips the unwanted commands */
  118. /* from the input file and outputs the rest */
  119.  
  120.     /* reset the input buffer */
  121.     binumber=0; biact=0;
  122.  
  123.     qfprintf(ERR_STREAM," [%s", str);
  124.     /* Test for !EOF now ((binumber == BUFFSIZE) || (biact < binumber)) */
  125.     do
  126.     {
  127.       t = (char)b_read(spfp);
  128.       if (t==0x1B)    /* Find the escape character */
  129.         {
  130.       t = (char)b_read(spfp);
  131.       if (t==0x2A)     /* This indiactes the start of a graphics command */
  132.         {
  133.  
  134.           t = (char)b_read(spfp);
  135.           switch(t)
  136.         {
  137.         case(0x70):
  138.           /* These are the graphics positioning commands */
  139.           /* Find the smallest x and y offsets */
  140.           num=0;
  141.           count=0;
  142.           for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  143.             numstr[count++]=t;
  144.           numstr[count]=0;
  145.           num= atoi (numstr);
  146.  
  147.           /* Take into account the possible different ordering */
  148.           /* of the commands (x first, y first) */
  149.  
  150.           if ((t==0x59)||(t==0x79))
  151.             {
  152.               if (numstr[0]!='+'&&numstr[0]!='-'&&numstr[0]!='-')
  153.             if (num<miny) miny=num;
  154.               if (t==0x79)
  155.             {
  156.               num=0;
  157.               count=0;
  158.               for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  159.                 numstr[count++]=t;
  160.               numstr[count]=0;
  161.               num=atoi (numstr);
  162.               if(numstr[0]!='+'&&numstr[0]!='-'&&numstr[0]!='-')
  163.                 if (num<minx) minx=num;
  164.             }
  165.             }
  166.           if ((t==0x58)||(t==0x78))
  167.             {
  168.               if (numstr[0]!='+'&&numstr[0]!='-'&&numstr[0]!='-')
  169.             if (num<minx) minx=num;
  170.               if (t==0x78)
  171.             {
  172.               num=0;
  173.               count=0;
  174.               for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  175.                 numstr[count++]=t;
  176.               numstr[count]=0;
  177.               num= atoi (numstr);
  178.               if (numstr[0]!='+'&&numstr[0]!='-'&&numstr[0]!='-')
  179.                 if (num<miny) miny=num;
  180.             }
  181.             }
  182.           break;
  183.           /* Ignore all other commands for the moment - just read them */
  184.         case(0x74):
  185.           for (t = (char)b_read(spfp); t != 0x52; t = (char)b_read(spfp));
  186.           break;
  187.  
  188.         case(0x72):
  189.           for (t = (char)b_read(spfp); ((t< 0x40)||(t>0x60)); t = (char)b_read(spfp));
  190.           break;
  191.  
  192.         case(0x62):
  193.           num=0;
  194.           count=0;
  195.           /* Read in the correct number of bytes of raster graphics */
  196.           /* so that we don't get commands and raster graphics confused */
  197.  
  198.           for (t = (char)b_read(spfp); ((t<0x40)||(t>=0x60)); t = (char)b_read(spfp))
  199.             numstr[count++]=t;
  200.           numstr[count]=0;
  201.           if (t==0x4D)
  202.             for(t=numstr[count=0];t!=0;t=numstr[++count]);
  203.           if (t==0x57)
  204.             {
  205.               for(t=numstr[count=0];t!=0;t=numstr[++count]);
  206.               for(count= atoi(numstr);count>0;count--)
  207.             t = (char)b_read(spfp);
  208.             }
  209.           break;
  210.  
  211.         case(0x63):
  212.           for (t = (char)b_read(spfp); ((t< 0x40)||(t>0x60)); t = (char)b_read(spfp));
  213.           break;
  214.  
  215.         default:
  216.           break;
  217.  
  218.  
  219.         }
  220.         }
  221.         }
  222.     }
  223.     while ((binumber == BUFFSIZE) || (biact < binumber));
  224.  
  225.     BCLOSE(spfp);
  226.     qfprintf(ERR_STREAM,"]");
  227.  
  228.     if ( (spfp = BINOPEN(str)) == FPNULL ) {
  229.       Warning("Unable to open file %s", str );
  230.       return;
  231.     }
  232.     qfprintf(ERR_STREAM," [%s", str);
  233.     /* reset input buffer again */
  234.     binumber = 0; biact = 0;
  235.  
  236. /* Pass through the input file again but this time output the */
  237. /* retained PCL commands */
  238.  
  239. /* Remark: I changed all instances of fputc (or rather write_byte) with EMITC to make the
  240.    whole thing somewhat more consistent. */
  241.  
  242.     do
  243.       {
  244.         t = (char)b_read(spfp);
  245.         if (t==0x1B)
  246.       {
  247.         t = (char)b_read(spfp);
  248.         if (t==0x2A)
  249.           {
  250.         t = (char)b_read(spfp);
  251.         switch(t)
  252.           {
  253.           case(0x70):
  254.             num=0;
  255.             count=0;
  256.             for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  257.               numstr[count++]=t;
  258.             numstr[count]=0;
  259.             num= atoi (numstr);
  260.             if ((t==0x59)||(t==0x79))
  261.               {
  262.             if (numstr[0]!='+'&&numstr[0]!='-')
  263.               {
  264.                 /* Subtract the minimum offset found in first pass */
  265.                 /* and add in the current vertical offset */
  266.                 ry=num-miny+(int)PIXROUND(v,vconv)+y_goffset;
  267.                 /* Output the new positioning command */
  268.                 EMIT(EMTO,"\033*p%dY",ry); EMFLUSH;
  269.               }
  270.  
  271.             else if (num>=0) {EMIT(EMTO,"\033*p%c%dY",numstr[0],num); EMFLUSH;}
  272.             else {EMIT(EMTO,"\033*p%dY",num); EMFLUSH;}
  273.  
  274.             if (t==0x79)
  275.               {
  276.                 num=0;
  277.                 count=0;
  278.                 for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  279.                   numstr[count++]=t;   /* reconstructed code */
  280.                 numstr[count]=0;
  281.                 num=atoi (numstr);
  282.                 if(numstr[0]!='+'&&numstr[0]!='-')
  283.                   {
  284.                 /*Add in correct horizontal offset */
  285.                 rx=num-minx+(int)PIXROUND(h,hconv)+x_goffset;
  286.                 EMIT(EMTO,"\033*p%dX",rx); EMFLUSH;
  287.                   }
  288.                 else if (num>=0) {EMIT(EMTO,"\033*p%c%dX",numstr[0],num); EMFLUSH;}
  289.                 else {EMIT(EMTO,"\033*p%dX",num); EMFLUSH;}
  290.               }
  291.               }
  292.  
  293.             if ((t==0x58)||(t==0x78))
  294.               {
  295.             if(numstr[0]!='+'&&numstr[0]!='-')
  296.               {
  297.                 /*Add in the correct horizontal offset*/
  298.                 rx=num-minx+(int)PIXROUND(h,hconv)+x_goffset;
  299.                 EMIT(EMTO,"\033*p%dX",rx); EMFLUSH;
  300.               }
  301.             else if (num>=0) {EMIT(EMTO,"\033*p%c%dX",numstr[0],num); EMFLUSH;}
  302.             else {EMIT(EMTO,"\033*p%dX",num); EMFLUSH;}
  303.  
  304.             if (t==0x78)
  305.               {
  306.                 num=0;
  307.                 count=0;
  308.                 for (t = (char)b_read(spfp); t<0x40; t = (char)b_read(spfp))
  309.                   numstr[count++]=t;
  310.                 numstr[count]=0;
  311.                 num= atoi (numstr);
  312.                 if(numstr[0]!='+'&&numstr[0]!='-')
  313.                   {
  314.                 /*Add in correct vertical offset*/
  315.                 ry=num-miny+(int)PIXROUND(v,vconv)+y_goffset;
  316.                 EMIT(EMTO,"\033*p%dY",ry); EMFLUSH;
  317.                   }
  318.                 else if (num >=0) {EMIT(EMTO,"\033*p%c%dY",numstr[0],num); EMFLUSH;}
  319.                 else {EMIT(EMTO,"\033*p%dY",num); EMFLUSH;}
  320.                                }
  321.               }
  322.             break;
  323.  
  324.           case(0x74):
  325.             /* Set the Raster resolution */
  326.             EMIT(EMTO,"\033*t"); EMFLUSH;
  327.             for (t = (char)b_read(spfp); t != 0x52; t = (char)b_read(spfp))
  328.               EMITC(t);
  329.             EMITC(t);
  330.             break;
  331.  
  332.           case(0x72):
  333.             /* Raster Graphics commands such as start */
  334.             EMIT(EMTO,"\033*r"); EMFLUSH;
  335.             for (t = (char)b_read(spfp); ((t< 0x40)||(t>0x60)); t = (char)b_read(spfp))
  336.               EMITC(t);
  337.             EMITC(t);
  338.             break;
  339.  
  340.           case(0x62):
  341.             /* Transfer the correct number of bytes of raster graphics */
  342.             EMIT(EMTO,"\033*b"); EMFLUSH;
  343.             num=0;
  344.             count=0;
  345.             for (t = (char)b_read(spfp); ((t<0x40)||(t>=0x60)); t = (char)b_read(spfp))
  346.               numstr[count++]=t;
  347.             numstr[count]=0;
  348.             if (t==0x4D)
  349.               {
  350.             for(t=numstr[count=0];t!=0;t=numstr[++count])
  351.               EMITC(t);
  352.             EMIT(EMTO,"M"); EMFLUSH;
  353.               }
  354.             if (t==0x57)
  355.               {
  356.             for(t=numstr[count=0];t!=0;t=numstr[++count])
  357.               EMITC(t);
  358.             EMIT(EMTO,"W"); EMFLUSH;
  359.             for(count= atoi(numstr);count>0;count--)
  360.               {
  361.                 t = (char)b_read(spfp);
  362.                 EMITC(t);
  363.               }
  364.               }
  365.             break;
  366.  
  367.           case(0x63):
  368.             /* Rectangular draw commands */
  369.             EMIT(EMTO,"\033*c"); EMFLUSH;
  370.             for (t = (char)b_read(spfp); ((t< 0x40)||(t>0x60)); t = (char)b_read(spfp))
  371.               EMITC(t);
  372.             EMITC(t);
  373.             break;
  374.  
  375.           default:
  376.             break;
  377.  
  378.  
  379.           }
  380.           }
  381.       }
  382.       }
  383.     while ((binumber == BUFFSIZE) || (biact < binumber));
  384.  
  385.     BCLOSE(spfp);
  386.     qfprintf(ERR_STREAM,"]");
  387. }
  388.  
  389.  
  390. /* This function closes all open files */
  391. void
  392. CloseFiles(void)
  393. {
  394.   struct font_entry *fe;
  395.   FILEPTR f;
  396.  
  397.     /* First input/output files */
  398.     if (outfp != FPNULL) {
  399.       #ifdef RISC_BUFFER
  400.       b_oflush(outfp);
  401.       #endif
  402.       BCLOSE(outfp);
  403.     }
  404.     if (dvifp != FPNULL) {BCLOSE(dvifp);}
  405.     if (metafile != FPNULL) {BCLOSE(metafile);}
  406.     /* Now all open font files */
  407.     fe = hfontptr;
  408.     while (fe != NULL)
  409.     {
  410.       f = fe->font_file_id;
  411.       if ((f != FPNULL) && (f != NO_FILE)) {BCLOSE(f);}
  412.       fe = fe->next;
  413.     }
  414. }
  415.  
  416.  
  417. /*-->Fatal*/
  418. /**********************************************************************/
  419. /******************************  Fatal  *******************************/
  420. /**********************************************************************/
  421. void
  422. Fatal(fmt, a, b, c)      /* issue a fatal error message */
  423. char *fmt;
  424. char *a, *b, *c;
  425. {
  426.  
  427.     fprintf(ERR_STREAM, "\n");
  428.     fprintf(ERR_STREAM, "%s: FATAL--", G_progname);
  429.     fprintf(ERR_STREAM, fmt, a, b, c);
  430.     fprintf(ERR_STREAM, "\n\n");
  431.     CloseFiles();
  432. #ifndef vms
  433.     exit(2);
  434. #else
  435.     exit(SS$_ABORT);
  436. #endif
  437. }
  438.  
  439.  
  440. /*-->GetBytes*/
  441. /**********************************************************************/
  442. /*****************************  GetBytes  *****************************/
  443. /**********************************************************************/
  444. /* get n bytes from file fp; now a macro, so we don't need it any more
  445. void
  446. GetBytes(FILEPTR fp, char *cp, int n)
  447. {
  448.   read_multi(cp,n,1,fp);
  449. }*/
  450.  
  451.  
  452. /*-->NoSignExtend*/
  453. /**********************************************************************/
  454. /***************************  NoSignExtend  ***************************/
  455. /**********************************************************************/
  456. long4
  457. NoSignExtend(FILEPTR fp, register int n)     /* return n byte quantity from file fd */
  458. {
  459.     long4    x=0;      /* number being constructed */
  460.     char h;
  461.     while (n--)  {
  462.         x <<= 8; read_byte(fp,h);
  463.         x |= h;
  464.     }
  465.     /* printf("[%x] ",x);*/
  466.     return(x);
  467. }
  468.  
  469.  
  470.  
  471. #ifndef ARITHMETIC_RIGHT_SHIFT
  472. long4   signTab[5] = {0,0x00000080,0x00008000,0x00800000,0x00000000};
  473. long4 extendTab[5] = {0,~0^0xff,~0^0xffff,~0^0xffffff,~0^0xffffffff};
  474. #endif
  475.  
  476. /*-->SignExtend*/
  477. /**********************************************************************/
  478. /****************************  SignExtend  ****************************/
  479. /**********************************************************************/
  480. long4
  481. SignExtend(FILEPTR fp, register int n)   /* return n byte quantity from file fd */
  482. {
  483.     int     n1;     /* number of bytes      */
  484.     long4    x;      /* number being constructed */
  485.     char h;
  486. #ifdef SIGN_DEBUG
  487.     long4    x0;     /* copy of x  */
  488. #endif
  489.     read_byte(fp,h); x=h;  /* get first (high-order) byte */
  490.     n1 = n--;
  491.     while (n--)  {
  492.         x <<= 8; read_byte(fp,h);
  493.         x |= h;
  494.     }
  495. /*
  496.  *   NOTE: This code assumes that the right-shift is an arithmetic, rather
  497.  *   than logical, shift which will propagate the sign bit right.   According
  498.  *   to Kernighan and Ritchie, this is compiler dependent!
  499.  */
  500.  
  501.    /* printf("[%x] ",x);*/
  502. #ifdef SIGN_DEBUG
  503.     x0 = x;
  504. #endif
  505.  
  506. #ifdef ARITHMETIC_RIGHT_SHIFT
  507.     x <<= 32 - 8 * n1;
  508.     x >>= 32 - 8 * n1; /* sign extend */
  509. #else
  510.     if (x & signTab[n1]) x |= extendTab[n1];
  511. #endif
  512.  
  513. #ifdef SIGN_DEBUG
  514.     fprintf(ERR_STREAM,"\tSignExtend(fp,%d)=%lX, was=%lX,%d\n",
  515.         n1,x,x0,x0&signTab[n1]);
  516. #endif
  517.  
  518. #ifdef DEBUG
  519.     if (Debug > 1)
  520.         fprintf(ERR_STREAM,"\tSignExtend(fp,%d)=%lx\n", n1, x);
  521. #endif
  522.     return(x);
  523. }
  524.  
  525.  
  526. #ifdef IBM3812
  527. /*-->PMPout*/
  528. /*****************************************************************************/
  529. /* This routine produces the PMP-envelopes for the 3812. Its semantics are:
  530.  
  531.    first arg == 0  ... flush buffer
  532.    first arg == -1 ... number of bytes specified in the second argument
  533.                have to be continuous, that is they must not
  534.                be disrupted by ENTER PMP etc.
  535.    first arg > 0       output first arg bytes
  536.  
  537.                If arg2 > OUTBUFSIZE ... flush buffer,
  538.                         switch to unbuffered mode
  539.                         (dont't collect PMP commands)
  540.                If arg2+bufferpointer > OUTBUFSIZE ... flush buffer,
  541.                         block will fit into buffer
  542.                otherwise ..... block will fit into buffer
  543.  
  544.   Buffering is done to reduce the ENTER PMP-commands. Initially
  545.   the 3812 is in PC-ASCII mode. In order to issue a PMP-command it is
  546.   necessary to enter PMP mode. The ENTER-PMP-command contains the
  547.   number of bytes that will be interpreted as PMP-commands. In the
  548.   most naive approach for each primitive command (eg. set cursor) you
  549.   have to produce a seperate ENTER-PMP-envelope (5 bytes). It is
  550.   favourable to collect as many PMP commands as possible in one envelope. */
  551. /*****************************************************************************/
  552. void
  553. PMPout(int l, char *s)
  554. {
  555.     static char     buffer[OUTBUFSIZE];
  556.     static unsigned short   bp = 0;         /* range 0..OUTBUFSIZE */
  557.     static long4     continuous = 0l;
  558.     static bool buffered = _TRUE;
  559.  
  560.     if (l == 0) {
  561.         if (bp == 0)
  562.             return;
  563.         EMIT(EMTO, "\033[C%c%c", (unsigned char)(bp & 0xFF),
  564.             (unsigned char)(bp >> 8)); EMFLUSH;
  565.         EMITB((int)bp, buffer);
  566.         bp = 0;
  567.         return;
  568.     }
  569.     if (l == -1) {
  570.         continuous = (long4)s;
  571.         if (continuous + (long4)bp + 5l > (long4) OUTBUFSIZE)
  572.             PMPflush;
  573.         buffered = (bool) ((continuous + 5l <= (long4) OUTBUFSIZE));
  574.         if (!buffered) {
  575.             EMIT(EMTO, "\033[C%c%c",
  576.                 (unsigned char)(continuous & 0xFF),
  577.                 (unsigned char)((continuous >> 8) & 0xFF)); EMFLUSH;
  578.         }
  579.         return;
  580.     }
  581.     if (buffered) {
  582.         register int    i;
  583.         if ( ((long4)l + bp) > OUTBUFSIZE)
  584.             PMPflush;
  585.         for (i = 0; i < l; i++)
  586.             buffer[bp+i] = s[i];
  587.         bp += (unsigned short)l;
  588.     } else {
  589.         EMITB((int)l, s);
  590.         buffered = (bool) ((continuous -= (long4)l) <= 0) ;
  591.     }
  592. }
  593.  
  594.  
  595. void
  596. PMPoutC(char c)
  597. {
  598.     PMPout(1, &c);
  599. }
  600.  
  601.  
  602. #endif
  603. #ifdef MSDOS
  604. /*-->AssureBinary*/
  605. /**********************************************************************/
  606. /*************************** AssureBinary *****************************/
  607. /**********************************************************************/
  608. /* This procedure is both DOS AND MSC dependent. The MSC file open on */
  609. /* a device ignores the 'binary' of the "wb" parameter and opens the  */
  610. /* file in ascii mode. This procedure sets the file f to binary mode  */
  611. /* if it is connected to a device that is not console input or output */
  612. /* or the null device. For other operating systems this routine is    */
  613. /* useless. (Background: MSDOS 3.2 Technical Reference upd 1 pg 6-137 */
  614. /**********************************************************************/
  615. void
  616. AssureBinary(FILEPTR f)
  617. {
  618.     union REGS regs;              /* registers for bios call */
  619.  
  620.     regs.h.ah = (unsigned char) 0x44;     /* IOCTL            */
  621.     regs.h.al = (unsigned char) 0x00;     /* get device information   */
  622.     regs.x.bx = (unsigned int) fileno(f); /* handle from MSC      */
  623.     intdos(®s, ®s);         /* call DOS interrupt       */
  624.                           /* ---> result in DX    */
  625.  
  626.     if (  (regs.h.dl & 0x80)     /* file handle points to a device */
  627.          && !(regs.h.dl & 0x07) )    /* neither console i/o or null    */ {
  628.  
  629.         regs.h.dl  |= 0x20;      /* set BINARY bit in device info  */
  630.  
  631.         regs.h.ah = (unsigned char) 0x44;    /* IOCTL         */
  632.         regs.h.al = (unsigned char) 0x01;    /* set device information*/
  633.         regs.x.bx = (unsigned int) fileno(f); /* handle from MSC      */
  634.         regs.h.dh = (unsigned char) 0x00;    /* clear DH          */
  635.         intdos(®s, ®s);           /* call DOS interrupt     */
  636.     }
  637. }
  638.  
  639.  
  640. #endif
  641.  
  642.  
  643.  
  644.  
  645. /*-->Warning*/
  646. /**********************************************************************/
  647. /*****************************  Warning  ******************************/
  648. /**********************************************************************/
  649. void                           /* issue a warning */
  650. Warning(char *fmt, char *a, char *b, char *c, char *d)
  651. {
  652.     if ( G_nowarn || G_quiet )
  653.         return;
  654.  
  655.     fprintf(ERR_STREAM, "%s: warning: ", G_progname);
  656.     fprintf(ERR_STREAM, fmt, a, b, c, d);
  657.     fprintf(ERR_STREAM, "\n");
  658. }
  659.  
  660.